package com.zhxy.manager.controller;


import com.zhxy.manager.entity.User;
import com.zhxy.manager.service.intf.UserService;
import com.zhxy.manager.vo.PageBean;
import com.zhxy.manager.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/api/user/")
public class UserController {
    @Autowired
    private UserService service;

    @PostMapping("save.do")
    public R save(User user){
        return service.save(user);
    }

    @GetMapping("pagewhere.do")
    public PageBean all(String name, int page, int limit){
        return service.queryPage(name, page, limit);
    }

    @GetMapping("login.do")
    public R login(User user, HttpSession session){
        return service.login(user,session);
    }

}
